package ar.com.ford.it.fullEconomics.persistence.dao.query;

import oracle.toplink.expressions.Expression;
import oracle.toplink.expressions.ExpressionBuilder;
import ar.com.ford.it.fullEconomics.persistence.dto.Teese01Economic;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesg01Plant;
import com.ford.it.persistence.impl.toplink.CustomExpressionFactory;

public class UnicDescriptionFindQuery  implements CustomExpressionFactory {
    public Expression createExpression(ExpressionBuilder builder,
            Object[] parameters) {
    Expression exp = null;
    Teese01Economic economicIndexDef = (Teese01Economic) parameters[0];

    String desc = economicIndexDef.getEese01EconNameN();
    Teesg01Plant plant = economicIndexDef.getEese01PlantCodeC();
    exp = builder.get("eese01EconNameN").toLowerCase().like(desc.toLowerCase());
    exp = exp.and(builder.get("eese01PlantCodeC").equal(plant));
 
    return exp;
    }
}
